home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Various / DevDisk 65 (1989)(DevWare PD).zip / DevDisk 65 (1989)(DevWare PD).adf / ifflib / iff.h < prev    next >
C/C++ Source or Header  |  1990-07-11  |  5KB  |  156 lines

  1. #ifndef LIBRARIES_IFF_H
  2. #define LIBRARIES_IFF_H
  3.  
  4. /* C include file for the iff.library V18.4, 28-Feb-90 by Chris Weber.
  5.    Should work for Lattice and Manx. */
  6.  
  7. #ifndef EXEC_TYPES_H
  8. #include <exec/types.h>
  9. #endif
  10.  
  11. #define IFFNAME "iff.library"
  12. #define IFFVERSION 18L                /* Current library version */
  13.  
  14. typedef void *IFFFILE;                /* The IFF 'FileHandle' structure */
  15.  
  16.  
  17. /************** FUNCTION DECLARATIONS ***********************************/
  18.  
  19. #ifdef AZTEC_C
  20. #define __ARGS(a) ()
  21. #define NO_PRAGMAS
  22. #else
  23. #define __ARGS(a) a
  24. #endif
  25.  
  26. IFFFILE    OpenIFF      __ARGS((char *));
  27. void    CloseIFF     __ARGS((IFFFILE));
  28. void   *FindChunk    __ARGS((IFFFILE,LONG));    /* Was struct Chunk * */
  29. struct BitMapHeader *GetBMHD __ARGS((IFFFILE));
  30. LONG    GetColorTab  __ARGS((IFFFILE,WORD *));
  31. BOOL    DecodePic    __ARGS((IFFFILE,struct BitMap *));
  32. BOOL    SaveBitMap   __ARGS((char *,struct BitMap *,WORD *,LONG));
  33. BOOL    SaveClip     __ARGS((char *,struct BitMap *,WORD *,LONG,LONG,LONG,LONG,LONG));
  34. LONG    IFFError     __ARGS((void));
  35. ULONG   GetViewModes __ARGS((IFFFILE));            /* ULONG since V18.1 */
  36. APTR    NewOpenIFF   __ARGS((char *,LONG));                /* Since V16.1 */
  37. BOOL    ModifyFrame  __ARGS((void *,struct BitMap *));    /* Since V18.1 */
  38.  
  39.  
  40. /************** ERROR-CODES *********************************************/
  41.  
  42. #define IFF_BADTASK -1              /* IFFError() called by wrong task */
  43.  
  44. #define IFF_CANTOPENFILE 16         /* File not found */
  45. #define IFF_READERROR 17            /* Error reading file */
  46. #define IFF_NOMEM 18                /* Not enough memory */
  47. #define IFF_NOTIFF 19               /* File is not an IFF file */
  48. #define IFF_WRITEERROR 20           /* Error writing file */
  49.  
  50. #define IFF_NOILBM 24               /* IFF file is not of type ILBM */
  51. #define IFF_NOBMHD 25               /* BMHD chunk not found */
  52. #define IFF_NOBODY 26               /* BODY chunk not found */
  53. #define IFF_TOOMANYPLANES 27        /* BODY has more planes than BitMap */
  54. #define IFF_UNKNOWNCOMPRESSION 28   /* Unknown compression type */
  55.  
  56. #define IFF_NOANHD 29                /* ANHD chunk not found (since V18.1) */
  57. #define IFF_NODLTA 30                /* DLTA chunk not found (since V18.1) */
  58.  
  59.  
  60. /************** COMMON IFF IDs ******************************************/
  61.  
  62. #define MakeID(a,b,c,d) ((ULONG)(a)<<24L|(ULONG)(b)<<16L|(c)<<8|(d))
  63.  
  64. /* List of the most useful IDs, NOT complete (to be continued sometimes...) */
  65.  
  66. #define ID_FORM MakeID('F','O','R','M')
  67. #define ID_PROP MakeID('P','R','O','P')
  68. #define ID_LIST MakeID('L','I','S','T')
  69. #define ID_CAT  MakeID('C','A','T',' ')
  70.  
  71. #define ID_ANIM MakeID('A','N','I','M')
  72. #define ID_ANHD MakeID('A','N','H','D')
  73. #define ID_ILBM MakeID('I','L','B','M')
  74. #define ID_BMHD MakeID('B','M','H','D')
  75. #define ID_BODY MakeID('B','O','D','Y')
  76. #define ID_CAMG MakeID('C','A','M','G')
  77. #define ID_CLUT MakeID('C','L','U','T')
  78. #define ID_CMAP MakeID('C','M','A','P')
  79. #define ID_CRNG MakeID('C','R','N','G')
  80. #define ID_DLTA MakeID('D','L','T','A')
  81. #define ID_SHAM MakeID('S','H','A','M')
  82.  
  83. #define ID_8SVX MakeID('8','S','V','X')
  84. #define ID_ATAK MakeID('A','T','A','K')
  85. #define ID_NAME MakeID('N','A','M','E')
  86. #define ID_RLSE MakeID('R','L','S','E')
  87. #define ID_VHDR MakeID('V','H','D','R')
  88.  
  89. #define FORM ID_FORM    /* Ancient compatibility only, don't use */
  90. #define PROP ID_PROP
  91. #define LIST ID_LIST
  92. #define CAT  ID_CAT
  93.  
  94.  
  95. /************** STRUCTURES **********************************************/
  96.  
  97. struct Chunk            /* Generic IFF chunk structure */
  98. {
  99.     LONG  ckID;
  100.     LONG  ckSize;
  101.     /* UBYTE ckData[1];    should be UBYTE ckData[ckSize] */
  102. };
  103.  
  104. struct BitMapHeader        /* BMHD chunk for ILBM files */
  105. {
  106.     UWORD w,h;
  107.     WORD  x,y;
  108.     UBYTE nPlanes;
  109.     UBYTE masking;
  110.     UBYTE compression;
  111.     UBYTE pad1;
  112.     UWORD transparentColor;
  113.     UBYTE xAspect,yAspect;
  114.     WORD  pageWidth,pageHeight;
  115. };
  116.  
  117. struct AnimHeader        /* ANHD chunk for ANIM files */
  118. {
  119.     UBYTE    Operation;
  120.     UBYTE    Mask;
  121.     UWORD    W;
  122.     UWORD    H;
  123.     WORD    X;
  124.     WORD    Y;
  125.     ULONG    AbsTime;
  126.     ULONG    RelTime;
  127.     UBYTE    Interleave;
  128.     UBYTE    pad0;
  129.     ULONG    Bits;
  130.     UBYTE    pad[16];
  131. };
  132.  
  133.  
  134. /************** PRAGMAS FOR LATTICE C V5.x ******************************/
  135.  
  136. /* Pragmas generated with: 'fd2pragma iff_lib.fd iffpragmas.h' */
  137.  
  138. #ifndef NO_PRAGMAS
  139. extern struct Library *IFFBase;
  140. #pragma libcall IFFBase OpenIFF 1e 801
  141. #pragma libcall IFFBase CloseIFF 24 901
  142. #pragma libcall IFFBase FindChunk 2a 902
  143. #pragma libcall IFFBase GetBMHD 30 901
  144. #pragma libcall IFFBase GetColorTab 36 8902
  145. #pragma libcall IFFBase DecodePic 3c 8902
  146. #pragma libcall IFFBase SaveBitMap 42 a9804
  147. /*#pragma libcall IFFBase SaveClip 48 210a9808*/
  148. #pragma libcall IFFBase IFFError 4e 0
  149. #pragma libcall IFFBase GetViewModes 54 901
  150. #pragma libcall IFFBase NewOpenIFF 5a 802
  151. #pragma libcall IFFBase ModifyFrame 60 8902
  152. #endif
  153.  
  154. #endif !LIBRARIES_IFF_H
  155.  
  156.